﻿@{
    Layout = "~/Views/Shared/_MiniLayout.cshtml";
    string toolbarItem = ViewBag.ToolbarItem ?? "add,edit,save,cancel,delete";
}

@section header{
}
@RenderSection("headHtml", false)
<div class="mini-toolbar" style="padding:2px;border:0;">
    <table style="width:100%;" id="searchForm">
        <tr>
            <td style="width:100%;">
                @RenderSection("toolbar", false)
            </td>
            <td style="white-space:nowrap;">
                @if (toolbarItem.Contains("add"))
                {
                    <a class="mini-button" iconCls="icon-add" plain="true" onclick="newRow()">新增</a>
                }
                @if (toolbarItem.Contains("edit"))
                {
                    <a class="mini-button" iconCls="icon-edit" plain="true" onclick="editRow()">编辑</a>
                }
                @if (toolbarItem.Contains("delete"))
                {
                    <a class="mini-button" iconCls="icon-remove" plain="true" onclick="removeRow()">删除</a>
                }
                @if (toolbarItem.Contains("save"))
                {
                    <span class="separator"></span>
                    <a class="mini-button" iconCls="icon-save" plain="true" onclick="saveData()">保存</a>
                }
                <a class="mini-button" iconCls="icon-collapse" plain="true" onclick="refreshData()">刷新</a>
            </td>
        </tr>
    </table>
</div>
<div class="mini-fit">
    @RenderBody()
</div>
@section script{
    <script type="text/javascript">
        //页面使用函数
        var grid=null,mg=null;
        function search(param) {
            if (mg) {
                mg.search(param);
            }
        }

        function newRow() {
            if (mg) {
                mg.newRow();
            }
        }

        function cancelRow() {
            if (mg) {
                mg.cancelRow();
            }
        }

        function editRow(uid) {
            if (mg) {
                mg.editRow(uid);
            }

        }

        function deleteRow(uid) {
            if (mg) {
                mg.deleteRow(uid);
            }
        }

        function recycleRow(uid) {
            if (mg) {
                mg.recycleRow(uid);
            }
        }

        function restoreRow(uid) {
            if (mg) {
                mg.restoreRow(uid);
            }
        }

        function updateRow(uid) {
            if (mg) {
                mg.updateRow(uid);
            }
        }
    </script>
    @RenderSection("script", false)
}
@section footer{
}
@RenderSection("footHtml", false)